home *** CD-ROM | disk | FTP | other *** search
- Path: vyger712.nando.net!user
- From: armckenz@nando.net (Ashley mckenzie)
- Newsgroups: comp.lang.c
- Subject: borland 4.51 huge * struct problem
- Date: Tue, 19 Mar 1996 18:52:33 -0500
- Organization: Nando.net Public Access
- Message-ID: <armckenz-1903961852330001@vyger712.nando.net>
- NNTP-Posting-Host: vyger712.nando.net
-
- I was wondering if anybody had encountered a similar problem:
-
- Under Win3.1/95 when accessing a field in a struct pointed
- to by a huge pointer, the pointer will wrap around a 64k
- segment boundary if the struct straddles such a boundary.
-
- ie
-
- typedef struct Junk {
- long a, b, c;
- } Junk;
-
- foo()
- {
- Junk huge *ptr;
-
- // assuming ptr is set up elsewhere
-
- ptr->b = 0;
- }
-
- If ptr's pointer value looks like: 1234:fffe (in hex) with 1234 being the
- segment and fffe being the offset, accessing field b in the struct will
- not result in the right result. The compiler will wrap fffe to zero and
- not properly increment the segment register resulting in an address
- of 1234:0000.
-
- Is there any way to correctly access the fields in a struct which straddles
- a segment border?
-
- System: Borland 4.51 under Windows 3.1 and 95 using the large memory model
- (16-bit compiler)
-
- Thanks
-